package com.kd.spring.unit;

import static org.junit.Assert.*;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.kd.spring.dao.UserDao;
import com.kd.spring.model.User;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations="classpath:springSqlConnect.xml")
public class UserDaoTest {
	@Autowired
	private UserDao userDao;
	
	@Test
	public void testSave() {
		User user = new User();
		user.setUserName("kevindai");
		user.setPassword("hello");
		userDao.save(user);
	}

	@Test
	public void testUpdate() {
		User user = new User();
		user.setUser_id(6);
		user.setUserName("kevindai");
		user.setPassword("hello");
		userDao.update(user);
	}

	@Test
	public void testDelete() {
		User user = new User();
		user.setUser_id(6);
		userDao.delete(user);
	}

}
